#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

def  iterater_n(n, operator, operand):
    ret = operand
    for i in range(n):
        ret = operator(ret)

    return ret


def test():
    l = lambda x : x**2
    x = 3
    total_times = 4
    ret = iterater_n(total_times, l, x)
    print(ret)

    ret = iterater_n(3, l, iterater_n(total_times-3, l, x))
    print(ret)

    ret = iterater_n(4, l, iterater_n(total_times-4, l, x))
    print(ret)


def main():
    print("start main")
    test()

if __name__ == "__main__":
    main()
